 function nameCheck() {
	 	if(document.forms[0].first_name.value == "")
	 	{
        	document.forms[0].first_name.focus();
	 		alert("Please enter your first name.");
	 		return false;
	 	}
	 	if(document.forms[0].last_name.value == "")
	 	{
        	document.forms[0].last_name.focus();
	 		alert("Please enter your last name.");
	 		return false;
	 	}        
	 	var rex = /^[a-zA-Z]+$/
        if (!rex.test(document.forms[0].first_name.value)) {
        	document.forms[0].first_name.focus();
        	alert("First name can only contains letters!");
	 		return false;
        }
        if (!rex.test(document.forms[0].last_name.value)) {
        	document.forms[0].last_name.focus();
        	alert("Last name can only contains letters!");
	 		return false;
        }
	 	if(!document.forms[0].middle_name.value == ""&& 
	 	   !rex.test(document.forms[0].middle_name.value))
	 	{
	       	document.forms[0].middle_name.focus();
        	alert("Middle name can only contains letters!");
	 		return false;
	 	}
	 	return true;
    }
 function universityValidate(data)
 {
	if(data.result == "false")
	{
		document.forms[0].university.focus();
		document.forms[0].submit.disabled = true;
		alert("University already in database!");
		return false;
	}
	else
	{
		document.forms[0].submit.disabled = false;
		return true;
	}
 }
 function universityCheck(loc){
	   $.getJSON( "UniversityValidation.jsp",{name :$("#university").val(), location:loc},universityValidate);
	 }
